################################################################################
## Group Identities and Parliamentary Debates: Replication package
## Fiva, Nedregård and Øien (2024)

# Description:

## Code to make Fig 2b: "Most divergent words across blocs"

################################################################################

# Packages 

library(xtable)
library(data.table)


# Directories (wd is set by master.R)
data.dir <-  "../data/3_model_output"
tab.dir  <- "../results/tables"


# Bloc
# Reading top50 divergent words

t <- fread(paste(data.dir, "di_trans_words_top50_bloc.csv", sep = "/"))


t <- t[, .(rank, words_H_translated, words_0_translated)]

# Top 15 words

t <- t[rank < 16]



t <- xtable(t, method = c("compact"), booktabs = T)



print.xtable(t, only.contents = T, comment = F, hline.after = NULL, 
             include.colnames = F, include.rownames = F, 
             file = paste(fig.dir, "fig2b.tex", sep = "/"))

